<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j"
	  xmlns:easy="http://easyfaces.com.br/easyfaces">
	
	<f:subview id="subviewManterModelo">
	
		<script type="text/javascript">		
			function preencheDadosPopupMarca(codigo, descricao) {
				document.getElementById('subviewManterModelo:formModeloManter:modelo_marca_codigo').value = codigo;
				document.getElementById('subviewManterModelo:formModeloManter:modelo_marca_descricao').value = descricao;
			}
		</script>
		
		<rich:modalPanel id="manterModelo" autosized="true"  headerClass="height:20px;" resizeable="false" >
			<f:facet name="header">
				<h:outputText id="id_modelo" value="#{modeloBackBean.modeloFormBean.head}" />
			</f:facet>
			<f:facet name="controls">
				<h:panelGroup>
					<h:graphicImage value="/images/close.gif" styleClass="botao_fechar_popup" id="hideLink">
						<rich:componentControl for="manterModelo" attachTo="hideLink" operation="hide" event="onclick" />
					</h:graphicImage>
				</h:panelGroup>
			</f:facet>
			<div class="red">
			<rich:messages id="msgModeloConsultar"></rich:messages>
			</div>
			<a4j:form ajaxSubmit="true" id="formModeloManter"
				 reRender="modelo_codigo, modelo_descricao, modelo_marca_codigo, modelo_marca_descricao">
			
                <h:panelGrid columns="2">
                	<h:outputLabel value="#{bundle.modelo_codigo}:" for="modelo_codigo" />
                    <h:inputText id="modelo_codigo" value="#{modeloBackBean.modeloFormBean.modeloManter.codigo}" 
                    label="#{bundle.modelo_codigo}" readonly="true" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" size="5" />
                    
                	<h:outputLabel value="*#{bundle.modelo_descricao}:" for="modelo_descricao" />
                    <h:inputText id="modelo_descricao" value="#{modeloBackBean.modeloFormBean.modeloManter.descricao}" 
                    label="#{bundle.modelo_descricao}" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" maxlength="40" size="40" />
            
               	</h:panelGrid>
                
                <div class="linha" />
                
                	<h:inputHidden id="modelo_marca_codigo" value="#{modeloBackBean.modeloFormBean.marcaManter.codigo}"  
                	label="#{bundle.modelo_marca_codigo}" />
                	
	                <h:panelGrid columns="3">
	                	                	
	                	<h:outputLabel value="*#{bundle.modelo_marca}:" for="modelo_marca_descricao" />
	                	<h:inputText id="modelo_marca_descricao" value="#{modeloBackBean.modeloFormBean.marcaManter.descricao}" 
	                				 label="#{bundle.modelo_marca_descricao}" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" 
	                				 size="40" maxlength="50" />
	                				 
	                    <a4j:commandButton value="#{bundle.modelo_btn_popup}" id="btnPopupMarca" reRender="formModeloManter" 
	                                 disabled="#{modeloBackBean.modeloFormBean.isDisabled}">
	                    <rich:componentControl for="popupMarca" attachTo="btnPopupMarca" operation="show" event="onclick" />
	                    </a4j:commandButton>
	                    
                	</h:panelGrid>
                	
                	<rich:jQuery selector="#modelo_marca_descricao" timing="onload" query="attr('readOnly', true)" />
          
			     <div class="linha"/>
                
                <a4j:commandButton action="#{modeloBackBean.manterModelo}" value="#{bundle.modelo_btn_gravar}" id="btnGravar" 
                	reRender="formModeloManter" disabled="#{modeloBackBean.modeloFormBean.isDisabled}" />
                
                <a4j:commandButton action="#{modeloBackBean.excluirModelo}" value="#{bundle.modelo_btn_excluir}" id="btnExcluir"
                	 reRender="gridModelo" disabled="#{!modeloBackBean.modeloFormBean.isDisabled}" >
                	<rich:componentControl for="manterModelo" attachTo="btnExcluir" operation="hide" event="onclick" />
                </a4j:commandButton>
                
                <a4j:commandButton value="#{bundle.modelo_btn_voltar}" id="btnVoltar" action="#{modeloBackBean.obterListaModelo}"
                	 reRender="gridModelo" >
                	<rich:componentControl for="manterModelo" attachTo="btnVoltar" operation="hide" event="onclick" />
                </a4j:commandButton>
					
			</a4j:form>

		</rich:modalPanel>
	</f:subview>
	
	<ui:include src="/pages/marca/popupMarca.xhtml" />

</html>